| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 1 | Gerrit Code Review - '/changes/' REST API |
| 2 | ========================================= |
| 3 | |
| 4 | This page describes the change related REST endpoints. |
| 5 | Please also take note of the general information on the |
| 6 | link:rest-api.html[REST API]. |
| 7 | |
| 8 | Endpoints |
| 9 | --------- |
| 10 | |
| Edwin Kempin | 7620274 | 2013-02-15 13:51:50 +0100 | [diff] [blame] | 11 | [[list-changes]] |
| Edwin Kempin | 82d3037 | 2013-02-04 08:49:34 +0100 | [diff] [blame] | 12 | GET /changes/ (Query Changes) |
| 13 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 14 | Queries changes visible to the caller. The query string must be |
| 15 | provided by the `q` parameter. The `n` parameter can be used to limit |
| 16 | the returned results. |
| 17 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 18 | As result a list of link:#change-info[ChangeInfo] entries is returned. |
| 19 | The change output is sorted by the last update time, most recently |
| 20 | updated to oldest updated. |
| 21 | |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 22 | Query for open changes of watched projects: |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 23 | |
| 24 | .Request |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 25 | ---- |
| Edwin Kempin | 2091edb | 2013-01-23 19:07:38 +0100 | [diff] [blame] | 26 | GET /changes/?q=status:open+is:watched&n=2 HTTP/1.0 |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 27 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 28 | |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 29 | .Response |
| 30 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 31 | HTTP/1.1 200 OK |
| 32 | Content-Disposition: attachment |
| 33 | Content-Type: application/json;charset=UTF-8 |
| 34 | |
| 35 | )]}' |
| 36 | { |
| 37 | "kind": "gerritcodereview#change", |
| 38 | "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57", |
| 39 | "project": "demo", |
| 40 | "branch": "master", |
| 41 | "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57", |
| 42 | "subject": "One change", |
| 43 | "status": "NEW", |
| 44 | "created": "2012-07-17 07:18:30.854000000", |
| 45 | "updated": "2012-07-17 07:19:27.766000000", |
| 46 | "reviewed": true, |
| Edwin Kempin | db1f0b8 | 2013-02-21 15:07:00 +0100 | [diff] [blame] | 47 | "mergeable": true, |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 48 | "_sortkey": "001e7057000006dc", |
| 49 | "_number": 1756, |
| 50 | "owner": { |
| 51 | "name": "John Doe" |
| 52 | }, |
| 53 | }, |
| 54 | { |
| 55 | "kind": "gerritcodereview#change", |
| 56 | "id": "demo~master~I09c8041b5867d5b33170316e2abc34b79bbb8501", |
| 57 | "project": "demo", |
| 58 | "branch": "master", |
| 59 | "change_id": "I09c8041b5867d5b33170316e2abc34b79bbb8501", |
| 60 | "subject": "Another change", |
| 61 | "status": "NEW", |
| 62 | "created": "2012-07-17 07:18:30.884000000", |
| 63 | "updated": "2012-07-17 07:18:30.885000000", |
| Edwin Kempin | db1f0b8 | 2013-02-21 15:07:00 +0100 | [diff] [blame] | 64 | "mergeable": true, |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 65 | "_sortkey": "001e7056000006dd", |
| 66 | "_number": 1757, |
| 67 | "owner": { |
| 68 | "name": "John Doe" |
| 69 | }, |
| 70 | "_more_changes": true |
| 71 | } |
| 72 | ---- |
| 73 | |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 74 | If the `n` query parameter is supplied and additional changes exist |
| 75 | that match the query beyond the end, the last change object has a |
| 76 | `_more_changes: true` JSON field set. Callers can resume a query with |
| Christian Aistleitner | 5536401 | 2013-02-17 12:18:22 +0100 | [diff] [blame] | 77 | the `N` query parameter, supplying the last change's `_sortkey` field |
| 78 | as the value. When going in the reverse direction with the `P` query |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 79 | parameter a `_more_changes: true` is put in the first change object if |
| 80 | there are results *before* the first change returned. |
| 81 | |
| 82 | Clients are allowed to specify more than one query by setting the `q` |
| 83 | parameter multiple times. In this case the result is an array of |
| 84 | arrays, one per query in the same order the queries were given in. |
| 85 | |
| Edwin Kempin | a64c4b9 | 2013-01-23 11:30:40 +0100 | [diff] [blame] | 86 | .Query for the 25 most recent open changes of the projects that you watch |
| 87 | **** |
| 88 | get::/changes/?q=status:open+is:watched&n=25 |
| 89 | **** |
| 90 | |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 91 | Query that retrieves changes for a user's dashboard: |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 92 | |
| 93 | .Request |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 94 | ---- |
| 95 | GET /changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS HTTP/1.0 |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 96 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 97 | |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 98 | .Response |
| 99 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 100 | HTTP/1.1 200 OK |
| 101 | Content-Disposition: attachment |
| 102 | Content-Type: application/json;charset=UTF-8 |
| 103 | |
| 104 | )]}' |
| 105 | [ |
| 106 | [ |
| 107 | { |
| 108 | "kind": "gerritcodereview#change", |
| 109 | "id": "demo~master~Idaf5e098d70898b7119f6f4af5a6c13343d64b57", |
| 110 | "project": "demo", |
| 111 | "branch": "master", |
| 112 | "change_id": "Idaf5e098d70898b7119f6f4af5a6c13343d64b57", |
| 113 | "subject": "One change", |
| 114 | "status": "NEW", |
| 115 | "created": "2012-07-17 07:18:30.854000000", |
| 116 | "updated": "2012-07-17 07:19:27.766000000", |
| 117 | "reviewed": true, |
| Edwin Kempin | db1f0b8 | 2013-02-21 15:07:00 +0100 | [diff] [blame] | 118 | "mergeable": true, |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 119 | "_sortkey": "001e7057000006dc", |
| 120 | "_number": 1756, |
| 121 | "owner": { |
| 122 | "name": "John Doe" |
| 123 | }, |
| 124 | "labels": { |
| 125 | "Verified": {}, |
| 126 | "Code-Review": {} |
| 127 | } |
| 128 | } |
| 129 | ], |
| 130 | [], |
| 131 | [] |
| 132 | ] |
| 133 | ---- |
| 134 | |
| Edwin Kempin | a64c4b9 | 2013-01-23 11:30:40 +0100 | [diff] [blame] | 135 | .Query the changes for your user dashboard |
| 136 | **** |
| 137 | get::/changes/?q=is:open+owner:self&q=is:open+reviewer:self+-owner:self&q=is:closed+owner:self+limit:5&o=LABELS |
| 138 | **** |
| 139 | |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 140 | Additional fields can be obtained by adding `o` parameters, each |
| 141 | option requires more database lookups and slows down the query |
| 142 | response time to the client so they are generally disabled by |
| 143 | default. Optional fields are: |
| 144 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 145 | [[labels]] |
| 146 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 147 | * `LABELS`: a summary of each label required for submit, and |
| 148 | approvers that have granted (or rejected) with that label. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 149 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 150 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 151 | [[detailed-labels]] |
| 152 | -- |
| Dave Borowitz | 4c7231a | 2013-01-30 16:18:59 -0800 | [diff] [blame] | 153 | * `DETAILED_LABELS`: detailed label information, including numeric |
| Dave Borowitz | 992ddd7 | 2013-02-13 11:53:17 -0800 | [diff] [blame] | 154 | values of all existing approvals, recognized label values, values |
| 155 | permitted to be set by the current user, and reviewers that may be |
| 156 | removed by the current user. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 157 | -- |
| Dave Borowitz | 4c7231a | 2013-01-30 16:18:59 -0800 | [diff] [blame] | 158 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 159 | [[current-revision]] |
| 160 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 161 | * `CURRENT_REVISION`: describe the current revision (patch set) |
| 162 | of the change, including the commit SHA-1 and URLs to fetch from. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 163 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 164 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 165 | [[all-revisions]] |
| 166 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 167 | * `ALL_REVISIONS`: describe all revisions, not just current. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 168 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 169 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 170 | [[current-commit]] |
| 171 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 172 | * `CURRENT_COMMIT`: parse and output all header fields from the |
| 173 | commit object, including message. Only valid when the current |
| 174 | revision or all revisions are selected. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 175 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 176 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 177 | [[all-commits]] |
| 178 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 179 | * `ALL_COMMITS`: parse and output all header fields from the |
| 180 | output revisions. If only `CURRENT_REVISION` was requested |
| 181 | then only the current revision's commit data will be output. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 182 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 183 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 184 | [[current-files]] |
| 185 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 186 | * `CURRENT_FILES`: list files modified by the commit, including |
| 187 | basic line counts inserted/deleted per file. Only valid when |
| 188 | the current revision or all revisions are selected. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 189 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 190 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 191 | [[all-files]] |
| 192 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 193 | * `ALL_FILES`: list files modified by the commit, including |
| 194 | basic line counts inserted/deleted per file. If only the |
| 195 | `CURRENT_REVISION` was requested the only that commit's |
| 196 | modified files will be output. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 197 | -- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 198 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 199 | [[detailed-accounts]] |
| 200 | -- |
| Dave Borowitz | 8926a88 | 2013-02-01 14:32:48 -0800 | [diff] [blame] | 201 | * `DETAILED_ACCOUNTS`: include `_account_id` and `email` fields when |
| 202 | referencing accounts. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 203 | -- |
| Dave Borowitz | 8926a88 | 2013-02-01 14:32:48 -0800 | [diff] [blame] | 204 | |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 205 | .Request |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 206 | ---- |
| 207 | GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES HTTP/1.0 |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 208 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 209 | |
| Edwin Kempin | 3744083 | 2013-02-06 11:36:00 +0100 | [diff] [blame] | 210 | .Response |
| 211 | ---- |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 212 | HTTP/1.1 200 OK |
| 213 | Content-Disposition: attachment |
| 214 | Content-Type: application/json;charset=UTF-8 |
| 215 | |
| 216 | )]}' |
| 217 | [ |
| 218 | { |
| 219 | "kind": "gerritcodereview#change", |
| 220 | "id": "demo~master~I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a", |
| 221 | "project": "gerrit", |
| 222 | "branch": "master", |
| 223 | "change_id": "I7ea46d2e2ee5c64c0d807677859cfb7d90b8966a", |
| 224 | "subject": "Use an EventBus to manage star icons", |
| 225 | "status": "NEW", |
| 226 | "created": "2012-04-25 00:52:25.580000000", |
| 227 | "updated": "2012-04-25 00:52:25.586000000", |
| Edwin Kempin | db1f0b8 | 2013-02-21 15:07:00 +0100 | [diff] [blame] | 228 | "mergeable": true, |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 229 | "_sortkey": "001c9bf400000061", |
| 230 | "_number": 97, |
| 231 | "owner": { |
| 232 | "name": "Shawn Pearce" |
| 233 | }, |
| 234 | "current_revision": "184ebe53805e102605d11f6b143486d15c23a09c", |
| 235 | "revisions": { |
| 236 | "184ebe53805e102605d11f6b143486d15c23a09c": { |
| 237 | "_number": 1, |
| 238 | "fetch": { |
| 239 | "git": { |
| 240 | "url": "git://localhost/gerrit", |
| 241 | "ref": "refs/changes/97/97/1" |
| 242 | }, |
| 243 | "http": { |
| 244 | "url": "http://127.0.0.1:8080/gerrit", |
| 245 | "ref": "refs/changes/97/97/1" |
| 246 | } |
| 247 | }, |
| 248 | "commit": { |
| 249 | "parents": [ |
| 250 | { |
| 251 | "commit": "1eee2c9d8f352483781e772f35dc586a69ff5646", |
| 252 | "subject": "Migrate contributor agreements to All-Projects." |
| 253 | } |
| 254 | ], |
| 255 | "author": { |
| 256 | "name": "Shawn O. Pearce", |
| 257 | "email": "sop@google.com", |
| 258 | "date": "2012-04-24 18:08:08.000000000", |
| 259 | "tz": -420 |
| 260 | }, |
| 261 | "committer": { |
| 262 | "name": "Shawn O. Pearce", |
| 263 | "email": "sop@google.com", |
| 264 | "date": "2012-04-24 18:08:08.000000000", |
| 265 | "tz": -420 |
| 266 | }, |
| 267 | "subject": "Use an EventBus to manage star icons", |
| 268 | "message": "Use an EventBus to manage star icons\n\nImage widgets that need to ..." |
| 269 | }, |
| 270 | "files": { |
| 271 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java": { |
| 272 | "lines_deleted": 8 |
| 273 | }, |
| 274 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java": { |
| 275 | "lines_inserted": 1 |
| 276 | }, |
| 277 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java": { |
| 278 | "lines_inserted": 11, |
| 279 | "lines_deleted": 19 |
| 280 | }, |
| 281 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java": { |
| 282 | "lines_inserted": 23, |
| 283 | "lines_deleted": 20 |
| 284 | }, |
| 285 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarCache.java": { |
| 286 | "status": "D", |
| 287 | "lines_deleted": 139 |
| 288 | }, |
| 289 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java": { |
| 290 | "status": "A", |
| 291 | "lines_inserted": 204 |
| 292 | }, |
| 293 | "gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java": { |
| 294 | "lines_deleted": 9 |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | } |
| 299 | } |
| 300 | ] |
| 301 | ---- |
| 302 | |
| Edwin Kempin | ff9e6e3 | 2013-02-21 13:07:11 +0100 | [diff] [blame] | 303 | [[get-change]] |
| 304 | GET /changes/\{change-id\} (Get Change) |
| 305 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 306 | Retrieves a change. |
| 307 | |
| 308 | .Request |
| 309 | ---- |
| 310 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940 HTTP/1.0 |
| 311 | ---- |
| 312 | |
| 313 | As response a link:#change-info[ChangeInfo] entity is returned that |
| 314 | describes the change. |
| 315 | |
| 316 | .Response |
| 317 | ---- |
| 318 | HTTP/1.1 200 OK |
| 319 | Content-Disposition: attachment |
| 320 | Content-Type: application/json;charset=UTF-8 |
| 321 | |
| 322 | )]}' |
| 323 | { |
| 324 | "kind": "gerritcodereview#change", |
| 325 | "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940", |
| 326 | "project": "myProject", |
| 327 | "branch": "master", |
| 328 | "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940", |
| 329 | "subject": "Implementing Feature X", |
| 330 | "status": "NEW", |
| 331 | "created": "2013-02-01 09:59:32.126000000", |
| 332 | "updated": "2013-02-21 11:16:36.775000000", |
| 333 | "reviewed": true, |
| 334 | "mergeable": true, |
| 335 | "_sortkey": "0023412400000f7d", |
| 336 | "_number": 3965, |
| 337 | "owner": { |
| 338 | "name": "John Doe" |
| 339 | } |
| 340 | } |
| 341 | ---- |
| 342 | |
| Edwin Kempin | 8e49220 | 2013-02-21 15:38:25 +0100 | [diff] [blame] | 343 | [[get-change-detail]] |
| 344 | GET /changes/\{change-id\}/detail (Get Change Detail) |
| 345 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 346 | Retrieves a change with link:#labels[labels], link:#detailed-labels[ |
| 347 | detailed labels] and link:#detailed-accounts[detailed accounts]. |
| 348 | |
| 349 | .Request |
| 350 | ---- |
| 351 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0 |
| 352 | ---- |
| 353 | |
| 354 | As response a link:#change-info[ChangeInfo] entity is returned that |
| 355 | describes the change. |
| 356 | |
| 357 | .Response |
| 358 | ---- |
| 359 | HTTP/1.1 200 OK |
| 360 | Content-Disposition: attachment |
| 361 | Content-Type: application/json;charset=UTF-8 |
| 362 | |
| 363 | )]}' |
| 364 | { |
| 365 | "kind": "gerritcodereview#change", |
| 366 | "id": "myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940", |
| 367 | "project": "myProject", |
| 368 | "branch": "master", |
| 369 | "change_id": "I8473b95934b5732ac55d26311a706c9c2bde9940", |
| 370 | "subject": "Implementing Feature X", |
| 371 | "status": "NEW", |
| 372 | "created": "2013-02-01 09:59:32.126000000", |
| 373 | "updated": "2013-02-21 11:16:36.775000000", |
| 374 | "reviewed": true, |
| 375 | "mergeable": true, |
| 376 | "_sortkey": "0023412400000f7d", |
| 377 | "_number": 3965, |
| 378 | "owner": { |
| 379 | "_account_id": 1000096, |
| 380 | "name": "John Doe", |
| 381 | "email": "john.doe@example.com" |
| 382 | }, |
| 383 | "labels": { |
| 384 | "Verified": { |
| 385 | "all": [ |
| 386 | { |
| 387 | "value": 0, |
| 388 | "_account_id": 1000096, |
| 389 | "name": "John Doe", |
| 390 | "email": "john.doe@example.com" |
| 391 | }, |
| 392 | { |
| 393 | "value": 0, |
| 394 | "_account_id": 1000097, |
| 395 | "name": "Jane Roe", |
| 396 | "email": "jane.roe@example.com" |
| 397 | } |
| 398 | ], |
| 399 | "values": { |
| 400 | "-1": "Fails", |
| 401 | " 0": "No score", |
| 402 | "+1": "Verified" |
| 403 | } |
| 404 | }, |
| 405 | "Code-Review": { |
| 406 | "recommended": { |
| 407 | "_account_id": 1000097, |
| 408 | "name": "Jane Roe", |
| 409 | "email": "jane.roe@example.com" |
| 410 | }, |
| 411 | "disliked": { |
| 412 | "_account_id": 1000096, |
| 413 | "name": "John Doe", |
| 414 | "email": "john.doe@example.com" |
| 415 | }, |
| 416 | "all": [ |
| 417 | { |
| 418 | "value": -1, |
| 419 | "_account_id": 1000096, |
| 420 | "name": "John Doe", |
| 421 | "email": "john.doe@example.com" |
| 422 | }, |
| 423 | { |
| 424 | "value": 1, |
| 425 | "_account_id": 1000097, |
| 426 | "name": "Jane Roe", |
| 427 | "email": "jane.roe@example.com" |
| 428 | } |
| 429 | ] |
| 430 | "values": { |
| 431 | "-2": "Do not submit", |
| 432 | "-1": "I would prefer that you didn\u0027t submit this", |
| 433 | " 0": "No score", |
| 434 | "+1": "Looks good to me, but someone else must approve", |
| 435 | "+2": "Looks good to me, approved" |
| 436 | } |
| 437 | } |
| 438 | }, |
| 439 | "permitted_labels": { |
| 440 | "Verified": [ |
| 441 | "-1", |
| 442 | " 0", |
| 443 | "+1" |
| 444 | ], |
| 445 | "Code-Review": [ |
| 446 | "-2", |
| 447 | "-1", |
| 448 | " 0", |
| 449 | "+1", |
| 450 | "+2" |
| 451 | ] |
| 452 | }, |
| 453 | "removable_reviewers": [ |
| 454 | { |
| 455 | "_account_id": 1000096, |
| 456 | "name": "John Doe", |
| 457 | "email": "john.doe@example.com" |
| 458 | }, |
| 459 | { |
| 460 | "_account_id": 1000097, |
| 461 | "name": "Jane Roe", |
| 462 | "email": "jane.roe@example.com" |
| 463 | } |
| 464 | ] |
| 465 | } |
| 466 | ---- |
| 467 | |
| Edwin Kempin | 64006bb | 2013-02-22 08:17:04 +0100 | [diff] [blame] | 468 | [[get-topic]] |
| 469 | GET /changes/\{change-id\}/topic (Get Topic) |
| 470 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 471 | Retrieves the topic of a change. |
| 472 | |
| 473 | .Request |
| 474 | ---- |
| 475 | GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0 |
| 476 | ---- |
| 477 | |
| 478 | .Response |
| 479 | ---- |
| 480 | HTTP/1.1 200 OK |
| 481 | Content-Disposition: attachment |
| 482 | Content-Type: application/json;charset=UTF-8 |
| 483 | |
| 484 | )]}' |
| 485 | "Documentation" |
| 486 | ---- |
| 487 | |
| 488 | If the change does not have a topic an empty string is returned. |
| 489 | |
| 490 | [[set-topic]] |
| 491 | PUT /changes/\{change-id\}/topic (Set Topic) |
| 492 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 493 | Sets the topic of a change. |
| 494 | |
| 495 | The new topic must be provided in the request body inside a |
| 496 | link:#topic-input[TopicInput] entity. |
| 497 | |
| 498 | .Request |
| 499 | ---- |
| 500 | PUT /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0 |
| 501 | Content-Type: application/json;charset=UTF-8 |
| 502 | |
| 503 | { |
| 504 | "topic": "Documentation" |
| 505 | } |
| 506 | ---- |
| 507 | |
| 508 | As response the new topic is returned. |
| 509 | |
| 510 | .Response |
| 511 | ---- |
| 512 | HTTP/1.1 200 OK |
| 513 | Content-Disposition: attachment |
| 514 | Content-Type: application/json;charset=UTF-8 |
| 515 | |
| 516 | )]}' |
| 517 | "Documentation" |
| 518 | ---- |
| 519 | |
| 520 | If the topic was deleted the response is "`204 No Content`". |
| 521 | |
| 522 | [[delete-topic]] |
| 523 | DELETE /changes/\{change-id\}/topic (Delete Topic) |
| 524 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 525 | Deletes the topic of a change. |
| 526 | |
| 527 | The request body does not need to include a link:#topic-input[ |
| 528 | TopicInput] entity if no review comment is added. |
| 529 | |
| 530 | Please note that some proxies prohibit request bodies for DELETE |
| 531 | requests. In this case, if you want to specify a commit message, use |
| 532 | link:#set-topic[PUT] to delete the topic. |
| 533 | |
| 534 | .Request |
| 535 | ---- |
| 536 | DELETE /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/topic HTTP/1.0 |
| 537 | ---- |
| 538 | |
| 539 | .Response |
| 540 | ---- |
| 541 | HTTP/1.1 204 No Content |
| 542 | ---- |
| 543 | |
| Edwin Kempin | ff9e6e3 | 2013-02-21 13:07:11 +0100 | [diff] [blame] | 544 | |
| 545 | [[ids]] |
| 546 | IDs |
| 547 | --- |
| 548 | |
| 549 | [[change-id]] |
| 550 | \{change-id\} |
| 551 | ~~~~~~~~~~~~~ |
| 552 | Identifier that uniquely identifies one change. |
| 553 | |
| 554 | This can be: |
| 555 | |
| 556 | * an ID of the change in the format "'$$<project>~<branch>~<Change-Id>$$'", |
| 557 | where for the branch the `refs/heads/` prefix can be omitted |
| 558 | ("$$myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940$$") |
| 559 | * a Change-Id if it uniquely identifies one change |
| 560 | ("I8473b95934b5732ac55d26311a706c9c2bde9940") |
| 561 | * a legacy numeric change ID ("4247") |
| 562 | |
| 563 | |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 564 | [[json-entities]] |
| 565 | JSON Entities |
| 566 | ------------- |
| 567 | |
| 568 | [[account-info]] |
| 569 | AccountInfo |
| 570 | ~~~~~~~~~~~ |
| 571 | The `AccountInfo` entity contains information about an account. |
| 572 | |
| 573 | [options="header",width="50%",cols="1,^1,5"] |
| 574 | |=========================== |
| 575 | |Field Name ||Description |
| 576 | |`_account_id` ||The numeric ID of the account. |
| 577 | |`name` |optional|The full name of the user. + |
| 578 | Only set if link:#detailed-accounts[detailed account information] is |
| 579 | requested. |
| 580 | |`email` |optional| |
| 581 | The email address the user prefers to be contacted through. + |
| 582 | Only set if link:#detailed-accounts[detailed account information] is |
| 583 | requested. |
| 584 | |=========================== |
| 585 | |
| 586 | [[approval-info]] |
| 587 | ApprovalInfo |
| 588 | ~~~~~~~~~~~~ |
| 589 | The `ApprovalInfo` entity contains information about an approval from a |
| 590 | user for a label on a change. |
| 591 | |
| 592 | `ApprovalInfo` has the same fields as link:#account-info[AccountInfo]. |
| 593 | In addition `ApprovalInfo` has the following fields: |
| 594 | |
| 595 | [options="header",width="50%",cols="1,^1,5"] |
| 596 | |=========================== |
| 597 | |Field Name ||Description |
| 598 | |`value` ||The vote that the user has given for the label. |
| 599 | |=========================== |
| 600 | |
| 601 | [[change-info]] |
| 602 | ChangeInfo |
| 603 | ~~~~~~~~~~ |
| 604 | The `ChangeInfo` entity contains information about a change. |
| 605 | |
| 606 | [options="header",width="50%",cols="1,^1,5"] |
| 607 | |================================== |
| 608 | |Field Name ||Description |
| 609 | |`kind` ||`gerritcodereview#change` |
| 610 | |`id` || |
| 611 | The ID of the change in the format "'<project>\~<branch>~<Change-Id>'", |
| 612 | where project, branch and Change-Id are URL encoded. For branch the |
| 613 | `refs/heads/` prefix is omitted. |
| 614 | |`project` ||The name of the project. |
| 615 | |`branch` || |
| 616 | The name of the target branch. + |
| 617 | The `refs/heads/` prefix is omitted. |
| Edwin Kempin | cd6c01a1 | 2013-02-21 14:58:52 +0100 | [diff] [blame] | 618 | |`topic` |optional|The topic to which this change belongs. |
| Edwin Kempin | e344629 | 2013-02-19 16:40:14 +0100 | [diff] [blame] | 619 | |`change_id` ||The Change-Id of the change. |
| 620 | |`subject` || |
| 621 | The subject of the change (header line of the commit message). |
| 622 | |`status` || |
| 623 | The status of the change (`NEW`, `SUBMITTED`, `MERGED`, `ABANDONED`, |
| 624 | `DRAFT`). |
| 625 | |`created` || |
| 626 | The link:rest-api.html#timestamp[timestamp] of when the change was |
| 627 | created. |
| 628 | |`updated` || |
| 629 | The link:rest-api.html#timestamp[timestamp] of when the change was last |
| 630 | updated. |
| 631 | |`starred` |not set if `false`| |
| 632 | Whether the calling user has starred this change. |
| 633 | |`reviewed` |not set if `false`| |
| 634 | Whether the change was reviewed by the calling user. |
| 635 | |`mergeable` ||Whether the change is mergeable. |
| 636 | |`_sortkey` ||The sortkey of the change. |
| 637 | |`_number` ||The legacy numeric ID of the change. |
| 638 | |`owner` || |
| 639 | The owner of the change as an link:#account-info[AccountInfo] entity. |
| 640 | |`labels` |optional| |
| 641 | The labels of the change as a map that maps the label names to |
| 642 | link:#label-info[LabelInfo] entries. + |
| 643 | Only set if link:#labels[labels] or link:#detailed-labels[detailed |
| 644 | labels] are requested. |
| 645 | |`permitted_labels` |optional| |
| 646 | A map of the permitted labels that maps a label name to the list of |
| 647 | values that are allowed for that label. + |
| 648 | Only set if link:#detailed-labels[detailed labels] are requested. |
| 649 | |`removable_reviewers`|optional| |
| 650 | The reviewers that can be removed by the calling user as a list of |
| 651 | link:#account-info[AccountInfo] entities. + |
| 652 | Only set if link:#detailed-labels[detailed labels] are requested. |
| 653 | |`current_revision` |optional| |
| 654 | The commit ID of the current patch set of this change. + |
| 655 | Only set if link:#current-revision[the current revision] is requested |
| 656 | or if link:#all-revisions[all revisions] are requested. |
| 657 | |`revisions` |optional| |
| 658 | All patch sets of this changes as a map that maps the commit ID of the |
| 659 | patch set to a link:#revision-info[RevisionInfo] entity. + |
| 660 | Only set if link:#all-revisions[all revisions] are requested. |
| 661 | |`_more_changes` |optional, not set if `false`| |
| 662 | Whether the query would deliver more results if not limited. + |
| 663 | Only set on either the last or the first change that is returned. |
| 664 | |================================== |
| 665 | |
| 666 | [[commit-info]] |
| 667 | CommitInfo |
| 668 | ~~~~~~~~~~ |
| 669 | The `CommitInfo` entity contains information about a commit. |
| 670 | |
| 671 | [options="header",width="50%",cols="1,6"] |
| 672 | |========================== |
| 673 | |Field Name |Description |
| 674 | |`commit` |The commit ID. |
| 675 | |`parent` | |
| 676 | The parent commits of this commit as a list of |
| 677 | link:#commit-info[CommitInfo] entities. |
| 678 | |`author` |The author of the commit as a |
| 679 | link:#git-person-info[GitPersonInfo] entity. |
| 680 | |`committer` |The committer of the commit as a |
| 681 | link:#git-person-info[GitPersonInfo] entity. |
| 682 | |`subject` | |
| 683 | The subject of the commit (header line of the commit message). |
| 684 | |`message` |The commit message. |
| 685 | |========================== |
| 686 | |
| 687 | [[fetch-info]] |
| 688 | FetchInfo |
| 689 | ~~~~~~~~~ |
| 690 | The `FetchInfo` entity contains information about how to fetch a patch |
| 691 | set via a certain protocol. |
| 692 | |
| 693 | [options="header",width="50%",cols="1,6"] |
| 694 | |========================== |
| 695 | |Field Name |Description |
| 696 | |`url` |The URL of the project. |
| 697 | |`ref` |The ref of the patch set. |
| 698 | |========================== |
| 699 | |
| 700 | [[file-info]] |
| 701 | FileInfo |
| 702 | ~~~~~~~~ |
| 703 | The `FileInfo` entity contains information about a file in a patch set. |
| 704 | |
| 705 | [options="header",width="50%",cols="1,^1,5"] |
| 706 | |============================= |
| 707 | |Field Name ||Description |
| 708 | |`status` |optional| |
| 709 | The status of the file ("`A`"=Added, "`D`"=Deleted, "`R`"=Renamed, |
| 710 | "`C`"=Copied, "`W`"=Rewritten). + |
| 711 | Not set if the file was Modified ("`M`"). |
| 712 | |`binary` |not set if `false`|Whether the file is binary. |
| 713 | |`old_path` |optional| |
| 714 | The old file path. + |
| 715 | Only set if file was renamed or copied. |
| 716 | |`lines_inserted`|optional| |
| 717 | Number of inserted lines. + |
| 718 | Not set for binary files or if no lines were inserted. |
| 719 | |`lines_deleted` |optional| |
| 720 | Number of deleted lines. + |
| 721 | Not set for binary files or if no lines were deleted. |
| 722 | |============================= |
| 723 | |
| 724 | [[git-person-info]] |
| 725 | GitPersonInfo |
| 726 | ~~~~~~~~~~~~~ |
| 727 | The `GitPersonInfo` entity contains information about the |
| 728 | author/committer of a commit. |
| 729 | |
| 730 | [options="header",width="50%",cols="1,6"] |
| 731 | |========================== |
| 732 | |Field Name |Description |
| 733 | |`name` |The name of the author/committer. |
| 734 | |`email` |The email address of the author/committer. |
| 735 | |`date` |The link:rest-api.html#timestamp[timestamp] of when |
| 736 | this identity was constructed. |
| 737 | |`tz` |The timezone offset from UTC of when this identity was |
| 738 | constructed. |
| 739 | |========================== |
| 740 | |
| 741 | [[label-info]] |
| 742 | LabelInfo |
| 743 | ~~~~~~~~~ |
| 744 | The `LabelInfo` entity contains information about a label on a change. |
| 745 | |
| 746 | [options="header",width="50%",cols="1,^1,5"] |
| 747 | |=========================== |
| 748 | |Field Name ||Description |
| 749 | |`approved` |optional|The user who approved this label on the change |
| 750 | as a link:#account-info[AccountInfo] entity. + |
| 751 | Only set if link:#labels[labels] are requested. |
| 752 | |`rejected` |optional|The user who rejected this label on the change |
| 753 | as a link:#account-info[AccountInfo] entity. + |
| 754 | Only set if link:#labels[labels] are requested. |
| 755 | |`recommended` |optional|The user who recommended this label on the |
| 756 | change as a link:#account-info[AccountInfo] entity. + |
| 757 | Only set if link:#labels[labels] are requested. |
| 758 | |`disliked` |optional|The user who disliked this label on the change |
| 759 | as a link:#account-info[AccountInfo] entity. + |
| 760 | Only set if link:#labels[labels] are requested. |
| 761 | |`value` |optional|The voting value of the user who |
| 762 | recommended/disliked this label on the change if it is not |
| 763 | "`+1`"/"`-1`". + |
| 764 | Only set if link:#labels[labels] are requested. |
| 765 | |`optional` |not set if `false`| |
| 766 | Whether the label is optional. Optional means the label may be set, but |
| 767 | it's neither necessary for submission nor does it block submission if |
| 768 | set. |
| 769 | |`all` |optional|List of all approvals for this label as a list |
| 770 | of link:#approval-info[ApprovalInfo] entities. + |
| 771 | Only set if link:#detailed-labels[detailed labels] are requested. |
| 772 | |`values` |optional|A map of all values that are allowed for this |
| 773 | label. The map maps the values ("`-2`", "`-1`", " `0`", "`+1`", "`+2`") |
| 774 | to the value descriptions. + |
| 775 | Only set if link:#detailed-labels[detailed labels] are requested. |
| 776 | |=========================== |
| 777 | |
| 778 | [[revision-info]] |
| 779 | RevisionInfo |
| 780 | ~~~~~~~~~~~~ |
| 781 | The `RevisionInfo` entity contains information about a patch set. |
| 782 | |
| 783 | [options="header",width="50%",cols="1,^1,5"] |
| 784 | |=========================== |
| 785 | |Field Name ||Description |
| 786 | |`draft` |not set if `false`|Whether the patch set is a draft. |
| 787 | |`_number` ||The patch set number. |
| 788 | |`fetch` || |
| 789 | Information about how to fetch this patch set. The fetch information is |
| 790 | provided as a map that maps the protocol name ("`git`", "`http`", |
| 791 | "`ssh`") to link:#fetch-info[FetchInfo] entities. |
| 792 | |`commit` ||The commit of the patch set as |
| 793 | link:#commit-info[CommitInfo] entity. |
| 794 | |`files` || |
| 795 | The files of the patch set as a map that maps the file names to |
| 796 | link:#file-info[FileInfo] entities. |
| 797 | |=========================== |
| 798 | |
| Edwin Kempin | 64006bb | 2013-02-22 08:17:04 +0100 | [diff] [blame] | 799 | [[topic-input]] |
| 800 | TopicInput |
| 801 | ~~~~~~~~~~ |
| 802 | The `TopicInput` entity contains information for setting a topic. |
| 803 | |
| 804 | [options="header",width="50%",cols="1,^1,5"] |
| 805 | |=========================== |
| 806 | |Field Name ||Description |
| 807 | |`topic` |optional|The topic. + |
| 808 | The topic will be deleted if not set. |
| 809 | |`message` |optional| |
| 810 | Message to be added as review comment to the change when setting the |
| 811 | topic. |
| 812 | |=========================== |
| 813 | |
| Edwin Kempin | d0a6392 | 2013-01-23 16:32:59 +0100 | [diff] [blame] | 814 | |
| 815 | GERRIT |
| 816 | ------ |
| 817 | Part of link:index.html[Gerrit Code Review] |